﻿using System;
using System.Threading;
using System.Windows.Forms;
using UnionnetClient.Model;

namespace UnionnetClient
{
	static class Program
	{
		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main()
		{
			AppEnvironment.AppDataFolder = Application.UserAppDataPath;

			bool isFirst;
			Mutex mutex = new Mutex(true, "36df08b6-14c2-4410-8157-a7b93ed0af84", out isFirst); //单实例运行

			if (isFirst)
			{
				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);

				using (MainForm mainForm = new MainForm())
				{
					AppEnvironment.Run(new StateWithUiCreator(mainForm),
						delegate() { mainForm.NotifyIcon.ShowBalloonTip(10000,"自动登陆失败","请检查网络连接后手动登陆", ToolTipIcon.Error); });
					Application.Run();
				}
			}
			else
			{
				MessageBox.Show("请不要重复运行本程序！", "错误 - 聚友登陆客户端", MessageBoxButtons.OK, MessageBoxIcon.Information);
			}
		}
	}
}
